﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using Isha.Infrastructure;

namespace Isha.Data.Infrastructure
{
    internal class DatabaseFactory : Disposable, IDatabaseFactory
    {
        private IshaDbContext dataContext;

        protected override void DisposeCore()
        {
            if (dataContext != null)
                dataContext.Dispose();
        }

        public IshaDbContext Instance
        {
            get
            {
                return dataContext ?? (dataContext = new IshaDbContext());
            }
        }
    }
}
